{include file="public/header"/}
{load href="/public/static/Content/ThemesBusiness/FormPage.css"}
 <script src="/public/static/Scripts/ScriptsBusiness/VMFormData.js"></script>
<form id="formState" style="width:95%; text-align:center;">
    <table class="form_table" width="860px" style=" margin:0 auto;">
        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                停留时间
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text" name="time" value="{$info.time}" style="width:600px;"
                      data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>

         <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                是否允许修改页面
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <select class="easyui-combobox"  name="is_edit" data-options="required:true,tipPosition:'right'," style="width:152px;">
                    
                    <option value="1" {if condition="$info.is_edit eq 1"} selected="selected" {/if}  >允许</option>
                    
                    <option value="0"  {if condition="$info.is_edit eq 0"} selected="selected" {/if} >不允许</option>
                   
                </select>
            </td>
        </tr>

          <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                Logo
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="file"  style="width:600px;"
                      id="logo_img"  data-options="tipPosition:'right'," />
            </td>
        </tr>


        <tr class="form_tr">
           
            <td style="width:600px;padding-left:8px;" colspan="6" class="form_td form_td_content">
                <img id="logo_img_view" src="/uploads/client/logo/{$info.logo_img}" style="width: 60px;height: 40px;">
            </td>
        </tr>



         <!-- <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                背景照片
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
               <input class="easyui-validatebox" type="file"  style="width:600px;"
                      id="background_img"  data-options="tipPosition:'right'," />
            </td>
        </tr>

         <tr class="form_tr">
           
            <td style="width:600px;padding-left:8px;" colspan="6" class="form_td form_td_content">
                <img id="background_img_view" src="/uploads/client/background/{$info.background_img}" style="width: 60px;height: 40px;">
            </td>
        </tr> -->

        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                英文LOGO（白底）
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
               <input class="easyui-validatebox" type="file"  style="width:600px;"
                      id="logo1_img"  data-options="tipPosition:'right'," />
            </td>
        </tr>

         <tr class="form_tr">
           
            <td style="width:600px;padding-left:8px;" colspan="6" class="form_td form_td_content">
                <img id="logo1_img_view" src="/uploads/client/logo/{$info.text_img}" style="width: 60px;height: 40px;">
            </td>
        </tr>

        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                英文LOGO（透明底）
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
               <input class="easyui-validatebox" type="file"  style="width:600px;"
                      id="logo2_img"  data-options="tipPosition:'right'," />
            </td>
        </tr>



         <tr class="form_tr">
           
            <td style="width:600px;padding-left:8px;" colspan="6" class="form_td form_td_content" style="background: #000;">
                <img id="logo2_img_view" src="/uploads/client/logo/{$info.text1_img}" style="width: 60px;height: 40px;">
            </td>
        </tr>

        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                渐变背景色
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
               <input class="easyui-validatebox" type="text"  style="width:80px;"
                      name="bg_color1" value="{$info.bg_color1}"  data-options="tipPosition:'right'," />- <input class="easyui-validatebox" type="text"  style="width:80px;"
                      name="bg_color2" value="{$info.bg_color2}"  data-options="tipPosition:'right'," />
            </td>
        </tr>


        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                前台字体颜色
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
               <input class="easyui-validatebox" type="text"  style="width:80px;"
                      name="font_color" value="{$info.font_color}"  data-options="tipPosition:'right'," />
            </td>
        </tr>


      
      
      
        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                企业电话
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_tel" value="{$info.company_tel}" data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>

       
          <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                企业名称
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_name" value="{$info.company_name}" data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>
          <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                企业地址
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_addr" value="{$info.company_addr}" data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>
          <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                企业邮箱
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_email" value="{$info.company_email}" data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>

        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                联系人
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_person" value="{$info.company_person}" data-options="required:true,tipPosition:'right'," />
            </td>
        </tr>


       <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                联系人手机
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <input class="easyui-validatebox" type="text"  style="width:600px;"
                      name="company_phone" value="{$info.company_phone}" data-options="required:true,tipPosition:'right'," />  
            </td>
        </tr>



      
        <tr class="form_tr">
            <th style="padding-left:8px;width:80px;" class="form_td form_th_title">
                运行状态
            </th>
            <td style="width:600px;padding-left:8px;" colspan="5" class="form_td form_td_content">
                <select class="easyui-combobox"  name="status" data-options="required:true,tipPosition:'right'," style="width:152px;">
                	
                	<option value="1" {if condition="$info.status eq 1"} selected="selected" {/if}  >正常</option>
                	
                	<option value="0"  {if condition="$info.status eq 0"} selected="selected" {/if} >关闭</option>
                   
                </select>
            </td>
        </tr>

        <!-- 隐藏域 -->
        <input type="hidden" id="log_img_path" name="logo_img" value="{$info.logo_img}">
        <input type="hidden" id="background_img_path" name="background_img" value="{$info.background_img}">
        <input type="hidden" id="logo1_img_path" name="text_img" value="{$info.text_img}">
        <input type="hidden" id="logo2_img_path" name="text1_img" value="{$info.text1_img}">



      

        <script>
            var formData = new FormData();
        
            document.getElementById("logo_img").addEventListener("change", function (e) {

                const input = e.target;
                const files = e.target.files;
                if(files && files[0]) {
                   
                    const file = files[0];
                    if(file.size > 1024 * 1024 *3) {
                        input.value = '';
                        alert("图片太大");
                        return false;
                    }else{
                        //111start
                        formData.append('photo', document.getElementById('logo_img').files[0]);
                        $.ajax({
                                url: '/admin/uploadimg/uploadfoundation.html?path=client&type=logo',
                                dataType: 'json',
                                type: 'POST',
                                async: false,
                                data:formData,
                                processData: false, // 使数据不做处理
                                contentType: false, // 不要设置Content-Type请求头
                                success: function (res) {
                                    console.log(res.img);
                                    if (res.status == 1) {
                                        $.messager.alert('提示', res.msg , 'ok');
                                        var imgurl=res.img;
                                        $("#log_img_path").val(imgurl);
                                        $("#logo_img_view").attr("src",'/uploads/client/logo/'+imgurl); 
                                    } else {
                                        //$("#logo_img").val('');
                                        $.messager.alert('提示', res.msg , 'error');
                                    }

                                },
                                error: function (response) {
                                    //$("#logo_img").val('');
                                    $.messager.alert('提示', '接口错误', 'error');
                                }
                        });

                        //111end
                    }
                }
            });

             document.getElementById("background_img").addEventListener("change", function (e) {
                const input = e.target;
                const files = e.target.files;
                if(files && files[0]) {
                   
                    const file = files[0];
                    if(file.size > 1024 * 1024 *3) {
                        input.value = '';
                        alert("图片太大");
                        return false;
                    }else{
                        //111start
                        formData.append('photo', document.getElementById('background_img').files[0]);
                        $.ajax({
                                url: '/admin/uploadimg/uploadfoundation.html?path=client&type=background',
                                dataType: 'json',
                                type: 'POST',
                                async: false,
                                data:formData,
                                processData: false, // 使数据不做处理
                                contentType: false, // 不要设置Content-Type请求头
                                success: function (res) {
                                    console.log(res.img);
                                    if (res.status == 1) {
                                        $.messager.alert('提示', res.msg , 'ok');
                                        var imgurl=res.img;
                                        $("#background_img_path").val(imgurl);
                                        $("#background_img_view").attr("src",'/uploads/client/background/'+imgurl); 
                                    } else {
                                        //$("#logo_img").val('');
                                        $.messager.alert('提示', res.msg , 'error');
                                    }

                                },
                                error: function (response) {
                                    //$("#logo_img").val('');
                                    $.messager.alert('提示', '接口错误', 'error');
                                }
                        });

                        //111end
                    }
                }
            });

            document.getElementById("logo1_img").addEventListener("change", function (e) {
                const input = e.target;
                const files = e.target.files;
                if(files && files[0]) {
                   
                    const file = files[0];
                    if(file.size > 1024 * 1024 *3) {
                        input.value = '';
                        alert("图片太大");
                        return false;
                    }else{
                        //111start
                        formData.append('photo', document.getElementById('logo1_img').files[0]);
                        $.ajax({
                                url: '/admin/uploadimg/uploadfoundation.html?path=client&type=logo',
                                dataType: 'json',
                                type: 'POST',
                                async: false,
                                data:formData,
                                processData: false, // 使数据不做处理
                                contentType: false, // 不要设置Content-Type请求头
                                success: function (res) {
                                    console.log(res.img);
                                    if (res.status == 1) {
                                        $.messager.alert('提示', res.msg , 'ok');
                                        var imgurl=res.img;
                                        $("#logo1_img_path").val(imgurl);
                                        $("#logo1_img_view").attr("src",'/uploads/client/logo/'+imgurl); 
                                    } else {
                                        //$("#logo_img").val('');
                                        $.messager.alert('提示', res.msg , 'error');
                                    }

                                },
                                error: function (response) {
                                    //$("#logo_img").val('');
                                    $.messager.alert('提示', '接口错误', 'error');
                                }
                        });

                        //111end
                    }
                }
            });

            document.getElementById("logo2_img").addEventListener("change", function (e) {
                const input = e.target;
                const files = e.target.files;
                if(files && files[0]) {
                   
                    const file = files[0];
                    if(file.size > 1024 * 1024 *3) {
                        input.value = '';
                        alert("图片太大");
                        return false;
                    }else{
                        //111start
                        formData.append('photo', document.getElementById('logo2_img').files[0]);
                        $.ajax({
                                url: '/admin/uploadimg/uploadfoundation.html?path=client&type=logo',
                                dataType: 'json',
                                type: 'POST',
                                async: false,
                                data:formData,
                                processData: false, // 使数据不做处理
                                contentType: false, // 不要设置Content-Type请求头
                                success: function (res) {
                                    console.log(res.img);
                                    if (res.status == 1) {
                                        $.messager.alert('提示', res.msg , 'ok');
                                        var imgurl=res.img;
                                        $("#logo2_img_path").val(imgurl);
                                        $("#logo2_img_view").attr("src",'/uploads/client/logo/'+imgurl); 
                                    } else {
                                        //$("#logo_img").val('');
                                        $.messager.alert('提示', res.msg , 'error');
                                    }

                                },
                                error: function (response) {
                                    //$("#logo_img").val('');
                                    $.messager.alert('提示', '接口错误', 'error');
                                }
                        });

                        //111end
                    }
                }
            });
        </script>
      
        
      
       
        <tr class="form_tr">
            <td class="form_button_panel" colspan="6" style="padding-right:8px">
                
                <a  id="save"  class="easyui-linkbutton form-toolbar-button" data-options="iconCls:'icon-save'">保存</a>
              
            </td>
        </tr>
    </table>
</form>
<script>
   $(function() {
       $("#save").on("click",function(){
                $.ajax({
                       type: 'POST',
                       url: "{:url('admin/client/save')}",
                       data:  $("#formState").serialize(),
                       dataType: "json",
                       async: false,
                    error: function(request) {
                        alert("发送请求失败！");
                    },
                   success: function(data){
                        if (data.status == 1) {          
                            $.messager.alert('提示', data.msg, 'info');
                            location.reload();
                              //closeDialog();
                        } else {
                            $.messager.alert('提示', data.msg, 'error');
                           // return;
                           // alert(data.msg);
                    
                        }
                       
                    } 
                });
       })
    })

   
</script>

{include file="public/footer"/}